Repository navigation
Write the fog-node log to a rotating file as well as to the console - #211
Merged
Merged
Conversation
…onsole fog-node logged to stdout and stderr only, so its log lived in journald, NSSM or launchd, which Node cannot read on every OS. The FOG 1.6 Log Viewer (#209) needs a file. - api/lib/file-logger.js: a captains-log custom logger (Node built-ins only). Each line is "<ISO time> <level>: <message>", on the console (error/warn/crit to stderr) and appended to <logDir>/fog-node.log. - Rotation at 10 MB, five old files kept. A failed rename (Windows, another program holding the file) logs once, keeps appending, and retries after another tenth of the limit. A log call never throws. - logDir: custom.logDir in config/local.js, else <app>/logs. The installer keeps an existing custom.logDir on a re-run, as it keeps custom.pkiDir. - Behavior change: the console prefix changes from captains-log's "warn: " to the time and level. At the production level "debug", info, verbose and silly lines are not written (captains-log order). - The mocha, UI-smoke and installer lifts log to temporary folders. Closes #208 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #208. Map: #155. Prerequisite of #209 (the Log Viewer).
What
api/lib/file-logger.jsis a captains-logcustomlogger, wired inconfig/log.js(inspect: false). It uses Node built-ins only.2026-11-17T16:04:42.123Z warn: message. It goes to the console (error, warn and crit to stderr, the rest to stdout) and is appended to<logDir>/fog-node.log..1to.5. A failed rename (Windows, a reader without share-delete) writes one stderr notice, keeps appending, and retries after another tenth of the limit. A log call never throws.logDiriscustom.logDirinconfig/local.js, else<app>/logs. The installer keeps an existingcustom.logDiron a re-run, as it keepscustom.pkiDir(readOldLocal,customLines). It asks no new question.docs/install.mdgains a section on the log file.Behavior change
warn:to the time and the level.debug, theinfo,verboseandsillylines are not written. That is captains-log's level order, unchanged. The docs say so.Tests
npm test: 549 passing.npm run test:ui,npm run test:ui:prodandnpm run test:installpass. Nologs/folder is left in the checkout.test/lib/file-logger.test.js(format, console split, rotation, the five-file limit, an unwritable folder, the rename-failure retry),test/lib/log-file-lift.test.js, andtest/setup/read-old-local.test.js. Each fails without the change.Review
Built by an executor (Sonnet). Spec review on Opus and standards review on Sonnet, two rounds each. The last finding was applied.
🤖 Generated with Claude Code